﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace OPM.Class
{
    public class UtilWeb
    {
        public static string GetParamWithValueMvcFormCollection(System.Web.Mvc.FormCollection f)
        {

            // Debug
            string debugCheckParams = f.AllKeys.
                Aggregate("", (current, k) => current + (k + "=" + (f[k] ?? "(NULL)") + "\r\n"));
            return debugCheckParams;
        }

        public static string ControllerName()
        {
            return "" + HttpContext.Current.Request.RequestContext.RouteData.Values["controller"];
        }

        public static string ActionName()
        {
            return "" + HttpContext.Current.Request.RequestContext.RouteData.Values["action"];
        }
    }
}